home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / FifoScheduler.cc,v < prev    next >
Text File  |  1989-02-21  |  2KB  |  126 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @@;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.34.33;  author grunwald;  state Exp;
  11. branches ;
  12. next     3.1;
  13.  
  14. 3.1
  15. date     88.12.20.13.48.44;  author grunwald;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     88.10.30.13.04.26;  author grunwald;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     88.09.18.16.42.20;  author grunwald;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @@
  32.  
  33.  
  34. 3.2
  35. log
  36. @Start using Gnu library heaps for schedulers
  37. @
  38. text
  39. @// This may look like C code, but it is really -*- C++ -*-
  40. // 
  41. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  42. //
  43. // written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  44. //
  45. #include "Thread.h"
  46. #include "FifoScheduler.h"
  47. #include "stream.h"
  48. #include "assert.h"
  49.  
  50. FifoScheduler::FifoScheduler(int defaultLength, bool xdebug)
  51.     : (xdebug), fifo(defaultLength)
  52. {
  53.     fifo.reSize(defaultLength);
  54. }
  55.  
  56. void
  57. FifoScheduler::add(Thread *t)
  58. {
  59.     fifo.add(&t);
  60. }
  61.  
  62. void
  63. FifoScheduler::add(double , Thread *)
  64. {
  65.     assert2(FALSE, "[FifoScheduler] add(when, thread) not provided");
  66. }
  67.  
  68. Thread *
  69. FifoScheduler::remove()
  70. {
  71.     AwesimeFifoItem item;
  72.     bool removed = fifo.remove(&item);
  73.     assert2( removed, " Attempted to remove non-existent item");
  74.     return( (Thread *) item);
  75. }
  76.  
  77. Thread *
  78. FifoScheduler::remove(Thread *t)
  79. {
  80.     AwesimeFifoItem item = (AwesimeFifoItem) t;
  81.     bool removed = fifo.remove(&item);
  82.     assert2( removed, " Attempted to remove non-existent item");
  83.     return(t);
  84. }
  85.  
  86. bool FifoScheduler::isEmpty()
  87. {
  88.     return(fifo.isEmpty());
  89. }
  90.  
  91. unsigned int FifoScheduler::size()
  92. {
  93.     return(fifo.size());
  94. }
  95.  
  96. void FifoScheduler::classPrintOn(ostream& s)
  97. {
  98.     s << "[FifoScheduler] " << fifo;
  99. }
  100. @
  101.  
  102.  
  103. 3.1
  104. log
  105. @Steay version
  106. @
  107. text
  108. @@
  109.  
  110.  
  111. 1.2
  112. log
  113. @*** empty log message ***
  114. @
  115. text
  116. @@
  117.  
  118.  
  119. 1.1
  120. log
  121. @Initial revision
  122. @
  123. text
  124. @d1 6
  125. @
  126.